//
//  RecommendHotCollectionViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/26.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "RecommendHotCollectionViewCell.h"
#import "MarkLabel.h"

@interface RecommendHotCollectionViewCell ()

@property (strong, nonatomic) UIImageView *goodIV;
@property (strong, nonatomic) UILabel *titleL;
@property (strong, nonatomic) MarkLabel *discountL;
@property (strong, nonatomic) UILabel *moneyL;

@end

@implementation RecommendHotCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self = [super initWithFrame:frame]) {
        
        [self.contentView addSubview:self.goodIV];
        [self.contentView addSubview:self.titleL];
        [self.contentView addSubview:self.discountL];
        [self.contentView addSubview:self.moneyL];
        
    }
    
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.goodIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(weakSelf.contentView.mas_top);
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.width.mas_equalTo(jisuan(220));
        make.height.mas_equalTo(jisuan(220));
        
    }];
    
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(weakSelf.goodIV.mas_bottom).with.offset(jisuan(10));
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(10));
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(10));
    }];

    [self.discountL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(10));
        make.top.mas_equalTo(weakSelf.titleL.mas_bottom).with.offset(jisuan(10));
        make.width.mas_equalTo(jisuan(70));
        make.height.mas_equalTo(jisuan(30));
        
    }];

    [self.moneyL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(10));
        make.top.mas_equalTo(weakSelf.discountL.mas_bottom).with.offset(jisuan(10));
    }];
}


#pragma mark -lazy
- (UIImageView *)goodIV {
    
    if (!_goodIV) {
        
        _goodIV = [[UIImageView alloc] init];
        _goodIV.contentMode = UIViewContentModeScaleAspectFit;
        _goodIV.backgroundColor = Colorf7f7f7;
        
    }
    
    return _goodIV;
}

- (UILabel *)titleL {
    
    if (!_titleL) {
        
        _titleL = [[UILabel alloc] init];
        _titleL.textColor = Color333333;
        _titleL.textAlignment = NSTextAlignmentLeft;
        _titleL.font = Font(24);
        _titleL.text = @"【杨幂同款】GUCCI 古驰 女士";
        _titleL.numberOfLines = 2;
        
    }
    
    return _titleL;
}

- (MarkLabel *)discountL {
    
    if (!_discountL) {
        
        _discountL = [[MarkLabel alloc] init];
        _discountL.textColor = Colorff0000;
        _discountL.textAlignment = NSTextAlignmentCenter;
        _discountL.font = Font(20);
        _discountL.text = @"9.9折";
        
        _discountL.backgroundColor = Colorffeeee;
        _discountL.layer.cornerRadius = jisuan(15);
        _discountL.layer.masksToBounds = YES;
        
    }
    
    return _discountL;
    
}

- (UILabel *)moneyL {
    
    if (!_moneyL) {
        
        _moneyL = [[UILabel alloc] init];
        _moneyL.textColor = Colorff0000;
        _moneyL.textAlignment = NSTextAlignmentLeft;
        _moneyL.font = [UIFont fontWithName:@"Helvetica-Bold" size:jisuan(24)];
        _moneyL.text = @"￥4139";
        
    }
    
    return _moneyL;
 
}

@end
